#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using std::vector;
using std::string;
using std::pair;
using std::max;

class big_int
{
   static const int base = 100000000;
   static const int max_length = 10000;
   static const int digits = 8;
   vector<long long> val;
public:
   big_int()
   {
   }
   big_int(string s)
   {
      string temp;
      size_t i;
      for (i = s.length(); i >= digits; i -= digits)
      {
         temp = s.substr(i - digits,digits);
         val.push_back(str_to_long_long(temp));
      }
      if (i != 0)
      {
         temp = s.substr(0,i);
         val.push_back(str_to_long_long(temp));
      }
   }
   big_int(const big_int& a) { val = a.val; }

   int length() const { return val.size(); }
   void change_length(size_t n) { val.resize(n); }

   long long big_int::comp (const big_int &b)
   {
      if (length()!=b.length())
         return length()-b.length();
      for (int i = length() - 1; i >= 0; i--)
      {
         if (val[i]!=b.val[i])
         {
            return val[i]-b.val[i];
         }
      }
      return 0;
   }
   bool equals0()
   {
      size_t l = length();
      for (size_t i = 0; i < l; i++)
      {
         if (val[i]!=0)
            return false;
      }
      return true;
   }
   string long_long_to_str(const long long &a)
   {
      if (a == 0)
         return "0";
      string temp = "";
      long long temp_int = a;
      while (temp_int > 0)
      {
         temp += temp_int % 10 + '0';
         temp_int /= 10;
      }
      reverse(temp.begin(),temp.end());
      return temp;
   }
   long long str_to_long_long(const string &s)
   {
      int temp_int = 0;
      int len;
      if (digits<s.length())
         len = digits;
      else
         len = s.length();
      for (int j = 0; j < len; j++)
            temp_int=temp_int*10+s[j]-'0';
      return temp_int;
   }
   string to_str()
   {
      string result = "";
      result += long_long_to_str(val.back());
      for (int i = length() - 2; i >= 0; i--)
      {
         string temp = long_long_to_str(val[i]);
         for (int j = temp.length(); j < digits; j++)
         {
            result += '0';
         }
         result += temp;
      }
      return result;
   }

   long long& big_int::operator [] (size_t i) { return val[i]; }
   big_int big_int::operator - (const big_int &a)
   {
      big_int result = *this;
      for (int i = 0; i < a.length(); i++)
      {
         result[i] -= a.val[i];
         if (result.val[i] < 0)
         {
            result[i] += base;
            result[i + 1]--;
         }
      }
      int pos = result.length()-1;
      while ((pos>0) && !result.val[pos])
         pos--;
      result.change_length(pos+1);
      return result;
}
   big_int big_int::operator * (const int &n)
   {
      big_int res;
      res.change_length(length()+1);
      val.resize(length()+1);
      long long r = 0;
      for (int i = 0; (i < res.length()) || r; i++)
      {
         res[i] = abs(val[i] * n) + r;
         r = res[i] / base;
         res[i] -= r*base;
      }
      while ((res.length()>0) && (!res[res.length()-1]))
         res.change_length(res.length()-1);
      val.resize(length()-1);
      return res;
   }
   pair<big_int, big_int> big_int::operator / (const big_int &a) 
   {
      big_int result;
      big_int current;
      result.change_length(length());
      big_int divisor = a;
      int x;
      for (int i = length() - 1; i >= 0; --i)
      {
         current.change_length(current.length()+1);
         for (int j = current.length()-1; j >= 1; j--)
            current[j]=current[j-1];
         current[0] = val[i];
         if (current.equals0())
            break;
         int pos = current.length()-1;
         while (pos > 0 && !current[pos])
            pos--;
         current.change_length(pos+1);
         int l = 0, r = base;
         x = 0;
         while (l <= r)
         {
            int m = (l + r) >> 1;
            big_int c = divisor * m;
            if (c <= current)
            {
               x = m;
               l = m + 1;
            } else
               r = m - 1;
         }
      result[i] = x;
      big_int dif = divisor * x;
      current = current - dif;
   } 
   int pos = result.length()-1;
   while (pos > 0 && !result[pos])
      pos--;
   result.change_length(pos+1);
   pos = current.length()-1;
   while (pos > 0 && !current[pos])
      pos--;
   current.change_length(pos+1);
   return std::make_pair(result, current);
}

   bool big_int::operator > (const big_int &b) { return (comp(b) > 0); }
   bool big_int::operator < (const big_int &b) { return (comp(b) < 0); }
   bool big_int::operator == (const big_int &b) { return (comp(b) == 0); }
   bool big_int::operator <= (const big_int &b) { return (comp(b) <= 0); }
   bool big_int::operator >= (const big_int &b) { return (comp(b) >= 0); }
};
int main()
{
   std::ifstream in("in.txt");
   std::ofstream out("out.txt");
   string s,s1;
   big_int a,b;
   pair<big_int,big_int> div_rem;
   while (in >> s >> s1)
   {
      a = big_int(s);
      b = big_int(s1);
      if (b.equals0())
      {
         out << "<error>\n\n";
      } else
      {
         div_rem = a / b;
         out << div_rem.first.to_str()<< '\n' << div_rem.second.to_str() << '\n';
      }
      out << '\n';
   }
   return 0;
}